<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0"
        />
        <link
            rel="shortcut icon"
            href="./favicon.ico"
            type="image/x-icon"
        />
        <link
            rel="stylesheet"
            href="./style.css"
        />
        <script src="/eel.js"></script>
        <title>Useful Tools for Windows</title>
    </head>
    <body class="dark:bg-[#36393f] dark:text-white">
        <h1 class="text-center">Useful Tools for Windows</h1>

        <dialog
            id="dialog"
            class="dark:bg-[#18191b] dark:text-white shadow-2xl shadow-blue-900 m-auto *:m-5 *:rounded-lg *:text-center"
        >
            <div class="grid">
                <h2>Captive Portal / Public Wi-Fi Login Page</h2>
                <p>Choose any of these</p>
                <button><a href="http://neverssl.com">NeverSSL</a></button>
                <button>
                    <a href="http://www.msftconnecttest.com/connecttest.txt"
                        >Microsoft</a
                    >
                </button>
                <button>
                    <a href="http://connectivitycheck.gstatic.com/generate_204"
                        >Google</a
                    >
                </button>
                <button><a href="http://captive.apple.com">Apple</a></button>
                <button>
                    <a href="http://detectportal.firefox.com/canonical.html"
                        >Mozilla</a
                    >
                </button>
                <button>
                    <a href="http://network-test.debian.org/nm">Debian</a>
                </button>
                <button onclick="document.getElementById('dialog').close()">
                    Close
                </button>
            </div>
        </dialog>

        <section class="columns-2">
            <h2><kbd>sudo</kbd> is required before using these tools</h2>
            <button onclick="window.location.href = 'ms-settings:developers'">
                Enable Windows 11 sudo
            </button>
            or
            <button
                onclick="if(confirm('This tool is provided by Gerardo Grignoli, By continuing you agree to MIT License.')) {eel.gsudo()}"
            >
                Install gsudo
            </button>
        </section>
        <div class="md:columns-2">
            <section>
                <h2>Files and Folders:</h2>
                <button onclick="eel.openHosts();">Open Hosts File</button>
                <button onclick="eel.openOfficeAddins();">
                    Open Office Addins Folder
                </button>
                <button onclick="eel.openCurrentUserStartMenu();">
                    Open Current User Start Menu Folder
                </button>
                <button onclick="eel.openAllUserStartMenu();">
                    Open All Users Start Menu Folder
                </button>
                <button onclick="eel.openSentTo();">Open SentTo Folder</button>
                <button onclick="eel.openCurrentUserStartup();">
                    Open Current User Startup Folder
                </button>
                <button onclick="eel.openAllUsersStartup();">
                    Open All Users Startup Folder
                </button>
                <button onclick="eel.openWordStartup();">
                    Open Word Startup Folder
                </button>
                <button onclick="eel.openPSReadLineHistory();">
                    Open PSReadLine History
                </button>
                <button onclick="eel.openAccountPictures();">
                    Open Account Pictures Folder
                </button>
                <button onclick="eel.openVirtualDisks();">
                    Open Virtual Disks Folder
                </button>
                <button onclick="eel.openApplicationsFolder();">
                    Open Applications Folder
                </button>
                <button
                    onclick="if(confirm('This tool is provided by ThioJoe, and requires internet connection to work By continuing you agree to GPL 3.0 License.')) { eel.superGodMode() }"
                >
                    Create Super God Mode Folder
                </button>
            </section>

            <section>
                <h2>Settings and Utilities:</h2>
                <button onclick="eel.openGodMode();">
                    Open All Tasks/God Mode
                </button>
                <button onclick="eel.openFolderOptions();">
                    Open Folder Options
                </button>
                <button onclick="eel.openInternetOptions();">
                    Open Internet Options
                </button>
                <button onclick="eel.openSoundOptions();">
                    Open Sound Options
                </button>
                <button onclick="eel.openPowerOptions();">
                    Open Power Options
                </button>
                <button onclick="eel.openOptionalFeatures();">
                    Open Optional Features
                </button>
                <button onclick="eel.openControlPanel();">
                    Open Control Panel
                </button>
                <button onclick="window.location.href = 'ms-settings:'">
                    Open Settings
                </button>
                <button onclick="eel.openTaskManager();">
                    Open Task Manager
                </button>
                <button onclick="eel.openTaskManagerEight();">
                    Open Task Manager (Windows 8 Style)
                </button>
                <button onclick="eel.openTaskManagerXP();">
                    Open Task Manager (Windows XP Style)
                </button>
                <button onclick="eel.openmsconfig();">Open msconfig</button>
                <button onclick="eel.openmsconfigXP();">
                    Open msconfig (Windows XP Style)
                </button>

                <button onclick="document.getElementById('dialog').showModal()">
                    Captive Portal / Public Wi-Fi Login Page
                </button>
                <button
                    onclick="if(confirm('This tool is provided by ThioJoe, and requires internet connection to work! By continuing you agree to GPL 3.0 License.')) { eel.fKeySender() }"
                >
                    Open F Key Sender
                </button>
                <button
                    onclick="if(confirm('This tool is provided by ThioJoe, and requires internet connection to work! By continuing you agree to GPL 3.0 License.')) { window.location.href = `https://thiojoe.github.io/Browser-Based-Tools` }"
                >
                    Open ThioJoe's Browser-Based-Tools
                </button>
                <button
                    onclick="if(confirm('This tool is provided by Chris Titus Tech, and requires internet connection to work! By continuing you agree to MIT License.')) { eel.titusWinutil() }"
                >
                    Open Chris Titus Tech's Windows Utility
                </button>
                <button onclick="eel.dotnetInstaller()">
                    Install .NET Framework 3.5
                </button>
                <button onclick="eel.updatePrograms()">Update Programs</button>
            </section>

            <section>
                <h2>Repair tools:</h2>
                <button
                    onclick="if(confirm('Do you want to shutdown your computer?')){eel.shutdown()}"
                >
                    Shutdown computer without fast startup
                </button>
                <button
                    onclick="if(confirm('Do you want to reboot your computer?')){eel.restart()}"
                >
                    Restart Computer
                </button>
                <button
                    onclick="if(confirm('Do you want to reboot your computer to the firmware (UEFI)?')){eel.restartToFirmware()}"
                >
                    Reboot to Firmware (UEFI)
                </button>
                <button onclick="eel.repairSystemFiles()">
                    Repair System files
                </button>
                <button onclick="eel.repairWindowsComponents()">
                    Repair Windows Components
                </button>
                <button onclick="eel.wsreset();">Reset Microsoft Store</button>
                <button onclick="eel.restartWinNat()">
                    Restart Windows NAT Service
                </button>
                <button onclick="eel.killNotRespondingApps();">
                    Kill Not Responding Apps
                </button>
                <button onclick="eel.cleanupTempFiles();">
                    Clear temporary files
                </button>
            </section>
        </div>
        <script>
            async function checkForUpdate(currentVersion) {
                const apiUrl =
                    "https://api.github.com/repos/fluentmoheshwar/useful-tools/releases/latest";

                try {
                    const response = await fetch(apiUrl);
                    if (!response.ok)
                        throw new Error("GitHub API request failed.");

                    const releaseData = await response.json();
                    const latestVersion = releaseData.tag_name;

                    if (latestVersion !== currentVersion) {
                        alert(
                            `🔔 Update available! Latest version: ${latestVersion}`,
                        );
                    }
                } catch (error) {
                    console.error(
                        `❌ Error checking for updates: ${error.message}`,
                    );
                }
            }

            // Example usage:
            checkForUpdate("v3.6");
        </script>
    </body>
</html>
